﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public partial class Manageweb_FanLi_ManageFanLiRule : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["MasterID"] == null)
        {
            Response.Redirect("../Default.aspx");
        }

        if (!Page.IsPostBack)
        {
            GetAllRules();
        }
    }

    protected void GetAllRules()
    {
        SQLExpressDAL.DealRecord obj = new SQLExpressDAL.DealRecord();
        this.GV_UserList.DataSource = obj.GetAllFanLiRule();
        this.GV_UserList.DataBind();
    }

    protected void btnDelete_Command(object sender, CommandEventArgs e)
    {
        string msg = "删除成功!";
        try
        {
            int recordID = Convert.ToInt16(e.CommandArgument);

            SQLExpressDAL.DealRecord obj = new SQLExpressDAL.DealRecord();
            int flag = obj.DeleteFanLiRule(recordID);

            if (flag == 0)
            {
                msg = "删除失败";
            }
        }
        catch
        {
            msg = "删除失败";
        }

        Page.ClientScript.RegisterStartupScript(this.GetType(),"msg","alert('删除成功!')",true);
        GetAllRules();
    }


    protected void GV_UserList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {

    }
}
